#include <iostream>
#include <cstring>

using namespace std;

int main(void)
{
	char str[100];
	int i = 0;

	cout << "string: ";
        do
        {
                scanf("%c", &str[i]);
                i ++;
        }
        while(str[i - 1] != '#');
        str[i - 1] = '\0';

	char ch;
	cout << "char: ";
	cin >> ch;

	int l = strlen(str);
	int a = 0;
	int sum = 0;

	for(i = 0; i < l; i ++)
	{
		if(str[i] == ch)
			sum ++;
	}

	cout << sum <<endl;
	return 0;
}
